package com.ciwong.epaper.modules.epaper.bean;

import com.google.gson.Gson;

import com.ciwong.mobilelib.bean.BaseBean;

import java.lang.reflect.Type;
import java.util.List;

/**
 * 分页数据基础类
 *
 * @author bin
 * @version ciwong v.1.0 2015/7/28 10:23
 * @since ciwong v.1.0
 */
public class BasePaging<T> extends BaseBean
{
    public boolean isHasWork() {
        return hasWork;
    }

    public void setHasWork(boolean hasWork) {
        this.hasWork = hasWork;
    }

    /**
     * 是否布置过作业
     */
    private boolean hasWork;


    public boolean isHasOldWork() {
        return hasOldWork;
    }

    public void setHasOldWork(boolean hasOldWork) {
        this.hasOldWork = hasOldWork;
    }

    private boolean hasOldWork;
    /**
     * 当前页
     */
    private int     page;

    /**
     * 当前数量
     */
    private int pageSize;

    /**
     * 总页数
     */
    private int pageCount;

    /**
     * 总数量
     */
    private int totalCount;

    /**
     * 列表
     */
    private List<T> pageList;

    /**
     * 书籍列表
     */
    private List<T> product;

    public List<T> getProduct() {
        return product;
    }

    public void setProduct(List<T> product) {
        this.product = product;
    }

    public int getPage()
    {
        return page;
    }

    public void setPage(int page)
    {
        this.page = page;
    }

    public int getPageSize()
    {
        return pageSize;
    }

    public void setPageSize(int pageSize)
    {
        this.pageSize = pageSize;
    }

    public int getPageCount()
    {
        return pageCount;
    }

    public void setPageCount(int pageCount)
    {
        this.pageCount = pageCount;
    }

    public int getTotalCount()
    {
        return totalCount;
    }

    public void setTotalCount(int totalCount)
    {
        this.totalCount = totalCount;
    }

    public List<T> getPageList()
    {
        return pageList;
    }

    public void setPageList(List<T> pageList)
    {
        this.pageList = pageList;
    }

    public String toJson(Class<T> clazz)
    {
        Gson gson = new Gson();
        Type objectType = getType(BasePaging.class, clazz);
        return gson.toJson(this, objectType);
    }

}
